package org.testis.gui.mvc.model.testdesign;

import org.testis.gui.mvc.controller.testdesign.LabelPairSettingsController;
import org.testis.gui.mvc.model.*;
import java.util.HashMap;

import org.testis.orm.refinedclasses.TestDesignTreeNode;

/**
 *
 * @author nurhat
 */
public class LabelPairSettingsModel extends AbstractModel {

    private TestDesignTreeNode m_selectedNode = null;
    private HashMap m_labels = new HashMap();
    private String m_lastError = "";

    public LabelPairSettingsModel() {
        super();
    }

    public TestDesignTreeNode getSelectedNode() {
        return m_selectedNode;
    }

    public void setSelectedNode(TestDesignTreeNode value) {
        TestDesignTreeNode oldValue = m_selectedNode;
        m_selectedNode = value;
        firePropertyChange(
                LabelPairSettingsController.SELECTED_NODE_PROPERTY,
                oldValue,
                value);
    }

    public void setLabelHashMap(HashMap labels) {
        if (labels == null) {
            return;
        }
//        HashMap oldLabels = m_labels;
        m_labels = labels;
        firePropertyChange(LabelPairSettingsController.LABELS_PROPERTY,
                null,
                labels);
    }

    public HashMap getLabelHashMap() {
        return m_labels;
    }

    public String getLastError() {
        return m_lastError;
    }

    public void setLastError(String val) {
        if (val == null) {
            val = "";
        }
        m_lastError = val;
        firePropertyChange(LabelPairSettingsController.ERROR_PROPERTY,
                null,
                val);
    }
}
